﻿@model FreightSoft.Models.CUSTOMER_ORDER

@{
    ViewBag.Title = "Details";
    Layout = "~/Views/Shared/_CashPayment.cshtml";  
}



<div id="page-wrap">
    <textarea id="header">INVOICE</textarea>

    <div id="identity">

        <textarea id="address">@Model.CUSTOMER.CUSTOMER_ID - @Model.CUSTOMER.NAME
@Model.CUSTOMER.ADDRESS
Email: @Model.CUSTOMER.EMAIL

Phone: @Model.CUSTOMER.PHONE</textarea>

        <div id="logo">



            <div id="logohelp">
                <input id="imageloc" type="text" size="50" value="" /><br />
                (max width: 540px, max height: 200px)
             
            </div>
            <img style="height:100px" id="image" src="http://upload.wikimedia.org/wikipedia/en/b/bd/Mediterranean_Shipping_Company_logo.png" alt="logo" />

        </div>

    </div>
    <div style="clear: both"></div>
    <div id="customer">

        <textarea id="customer-title">Mediterranean
Shipping Company</textarea>

        <table id="meta">
            <tr>
                <td class="meta-head">Invoice #</td>
                <td>
                    <textarea>@Model.ORDER_ID</textarea></td>
            </tr>
            <tr>

                <td class="meta-head">Date</td>
                <td>
                    <textarea id="date">@System.DateTime.Now.ToLongDateString()</textarea></td>
            </tr>
            <tr>
                <td class="meta-head">Amount Due</td>
                <td>
                    <div class="due">@String.Format("{0:C}", @Model.ORDER_LINE.Sum(o=>o.GROSS_AMOUNT))</div>
                </td>
            </tr>

        </table>

    </div>

    <table id="items">
        <tr>
            <th>Item</th>
            <th>Description</th>
            <th>Unit Cost</th>
            <th>Quantity</th>
            <th>Price</th>
        </tr>


        @foreach (FreightSoft.Models.ORDER_LINE line in Model.ORDER_LINE)
        {
            <tr class="item-row">
                <td class="item-name">
                    <div class="delete-wpr">
                        <textarea>@line.PART.PART_ID</textarea><a class="delete" href="javascript:;" title="Remove row">X</a>
                    </div>
                </td>
                <td class="description">
                    <textarea>@line.PART.PART_DESC</textarea></td>
                <td>
                    <textarea class="cost">@String.Format("{0:C}", line.PART.UNIT_COST)</textarea></td>
                <td>
                    <textarea class="qty">@line.QUANTITY</textarea></td>
                <td><span class="price">@String.Format("{0:C}", (line.PART.UNIT_COST * line.QUANTITY))</span></td>
            </tr>
            
        }

        <tr id="hiderow">
            <td colspan="5"><a id="addrow" href="javascript:;" title="Add a row">Add a row</a></td>
        </tr>

        <tr>
            <td colspan="2" class="blank"></td>
            <td colspan="2" class="total-line">Net Amount</td>
            <td class="total-value">
                <div id="subtotal">@String.Format("{0:C}", @Model.ORDER_LINE.Sum(o=>o.NET_AMOUNT))</div>
            </td>
        </tr>
        <tr>
            <td colspan="2" class="blank"></td>
            <td colspan="2" class="total-line">Tax Amount</td>
            <td class="total-value">
                <div id="total">@String.Format("{0:C}", @Model.ORDER_LINE.Sum(o=>o.TAX_AMOUNT))</div>
            </td>
        </tr>
        <tr>
            <td colspan="2" class="blank"></td>
            <td colspan="2" class="total-line">Gross Amount</td>

            <td class="total-value">
                <textarea id="paid">@String.Format("{0:C}", @Model.ORDER_LINE.Sum(o=>o.GROSS_AMOUNT))</textarea></td>
        </tr>
        <tr>
            <td colspan="2" class="blank"></td>
            <td colspan="2" class="total-line balance">Balance Due</td>
            <td class="total-value balance">
                <div class="due">@String.Format("{0:C}", @Model.ORDER_LINE.Sum(o=>o.GROSS_AMOUNT))</div>
            </td>
        </tr>
    </table>
    <p style="text-align: right">
        <a href="../../OrderLine/Index/@Model.ORDER_ID"><button style="height: 50px; width: 100px">Back</button></a>
        <a href="../../OrderLine/Invoice/@Model.ORDER_ID"><button style="height: 50px; width: 200px">Receive Cash Payment</button></a>
    </p>
</div>
